package gui.viewEntity;

import java.util.ArrayList;

import framework.classification.entities.ClAbstractEntity;
import framework.classification.library.AbstractClassfication;
import framework.entity.ACLEntity;
import framework.entity.ACLFunction;
import gui.controller.Controller;

public class ViewACLFunction extends ViewACLEntity{

	public ViewACLFunction(ACLEntity aclEntity,
			AbstractClassfication classfication,Controller controller) {
		super(aclEntity, classfication,controller);
		// TODO Auto-generated constructor stub
	}

	@Override
	public ArrayList<ClAbstractEntity> FillClassifyElement() {
		// TODO Auto-generated method stub
		ArrayList<ClAbstractEntity> list = new ArrayList<ClAbstractEntity>();
		if (classification.getFunctionRequired().containsKey(aclEntity.toString()))
			list.add(classification.getFunctionRequired().get(aclEntity.toString()));
		if (classification.getFunctionsProvided().containsKey(aclEntity.toString()))
			list.add(classification.getFunctionsProvided().get(aclEntity.toString()));
		//System.out.println(classification.getInterfacesProvided().toString());
		return list;
	}

	@Override
	public String getDescriptionLeft() {
		// TODO Auto-generated method stub
		return "Parameters";
	}

	@Override
	public String getDescriptionRight() {
		// TODO Auto-generated method stub
		return "Interfaces including function";
	}

	@Override
	public ArrayList<String> getLeftParty() {
		// TODO Auto-generated method stub
		ACLFunction func = (ACLFunction) aclEntity;
		ArrayList<String> result = new ArrayList<String>();
		for (String in : func.getIn()){
			result.add("IN-"+in);
		}
		result.add("OUT-"+func.getOut());
		return result;
	}

	@Override
	public ArrayList<String> getRightParty() {
		// TODO Auto-generated method stub
		ACLFunction func = (ACLFunction) aclEntity;
		ArrayList<String> result = new ArrayList<String>();
		//System.out.println(func.getName());
		if (classification.getStructure().getFunctionsToInterfaces().containsKey(func.getName())){
			for (String s :classification.getStructure().getFunctionsToInterfaces().get(func.getName())){
				result.add(s);
			}
		}

		return result;
	}

}
